package com.uni.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.uni.db.GenericService;
import com.uni.domain.Lection;

@Controller
@RequestMapping("/lectionDelete.htm")
public class LectionDelete {
    @Autowired
	@Qualifier("lectionService")
	private GenericService<Lection> lectionService;

	@RequestMapping(method = RequestMethod.GET)
    public String setupForm(@RequestParam(value="id", required=true) Long id, ModelMap model) {
        lectionService.delete(lectionService.get(id));
        return "courseList";
    }
}